from typing import List


class Solution:
    def diStringMatch(self, s: str) -> List[int]:
        a, b, ans = 0, len(s), []
        for i in s:
            if i == "I":
                ans.append(a)
                a += 1
            else:
                ans.append(b)
                b -= 1
        return ans + [a]